<template>
	<switch :checked="_value" :style="[{ transform: 'scale(' + props.scale + ')' }]" @change="swichChange" />
</template>

<script setup>
import { computed, ref, watch, onBeforeMount } from 'vue';
import { pub_props } from '@/uni_modules/ac-ui/utils/minxs/props';

const emits = defineEmits(['update:modelValue', 'change']);

const props = defineProps({
	...pub_props,
	modelValue: {
		type: Boolean,
	},
	checked: {
		type: Boolean,
	},
	scale: {
		type: String,
		default: '0.75',
	},
});

const _value = ref(props.modelValue);
watch(
	() => props.modelValue,
	() => (_value.value = props.modelValue)
);

function swichChange(e) {
	_value.value = e.detail.value;
	emits('update:modelValue', e.detail.value);
	return e.detail.value;
}

// watch(() => props.modelValue, () => { console.log('123'); return _value.value = props.modelValue });
</script>

<style></style>
